<div class="panel panel-box">
    <div class="panel-heading">
            <h3 class="panel-title">
            <?php if(yii::app()->user->isGuest):?>
                <?php echo '登陆系统'?>
            <?php else:?>
                <?php echo '当前用户'?>
            <?php endif;?>
            </h3>
    </div>
    <?php if(yii::app()->user->isGuest):?>
    <div class="panel-body" id="loginboxform" url="<?php echo yii::app()->baseUrl.'/site/ajaxlogin'?>">
     <?php $model = new LoginForm;?>
     <?php $this->controller->renderPartial('//site/ajaxlogin',array('model'=>$model));?>
    </div>
    <?php else:?>
        <?php $user = User::model()->findByPk(yii::app()->user->id)?>
    <div class="panel-body" id="loginboxform" url="<?php echo yii::app()->baseUrl.'/site/ajaxlogin'?>">
        <table class="table table-striped" style="margin-bottom:0px">
            <tbody>
                <tr>
                    <td style="border-right:1px solid #DDD">用户名</td>
                    <td><?php echo yii::app()->user->name?></td>
                </tr>
                <tr>
                    <td style="border-right:1px solid #DDD">角色</td>
                    <td>
                    <?php if(yii::app()->user->checkAccess('admin')):?>
                        <?php echo '系统管理员'?>
                    <?php else:?>
                        <?php echo '普通用户'?>
                    <?php endif;?>
                    </td>
                </tr>
                <tr>
                    <td style="border-right:1px solid #DDD">在线</td>
                    <td>
                        <span id="formattimepass">
                        </span>
                        <span id="timepass" style="display:none">
                            <?php $last = CDateTimeParser::parse($user->last_login_date,'yyyy-MM-dd hh:mm:ss');?>
                            <?php $pass = time() - $last;?>
                            <?php echo $pass?>
                        </span>
                    </td>
                </tr>
                <tr style="border-bottom:1px solid #DDD">
                    <td style="border-right:1px solid #DDD">操作</td>
                    <td>
                        <a href="<?php echo yii::app()->baseUrl.'/user/view'?>">个人信息</a>
                        <?php if(yii::app()->user->checkAccess('admin')):?>
                        <a href="<?php echo yii::app()->baseUrl.'/admin'?>">后台管理</a>
                        <?php endif;?>
                        <a href="<?php echo yii::app()->baseUrl.'/site/logout'?>">退出</a>
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
    <?php endif;?>
</div>
